package cn.hbads.version.domain.calendar.model;

import cn.hbads.version.domain.version.aggregate.DataVersion;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

/**
 * <b> 数据持有身份映射模型 </b>
 *
 * @author : yvvb
 * @date : 2025/5/8
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DataIdentityModel {
    private String dataId;
    private Integer dataType;
    private LocalDate versionDate;

    public static DataIdentityModel buildFrom(DataVersion<?> originDataVersion) {
        return DataIdentityModel.builder()
                .dataId(originDataVersion.getDataId().toString())
                .dataType(originDataVersion.getDataType())
                .versionDate(originDataVersion.getVersionDate())
                .build();
    }

}
